package com.example.chamberlainserver.util;

import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class DateUtil {

    public static List<Integer> generateSequence(LocalDate startDate, LocalDate endDate) {
        if (startDate == null || endDate == null || startDate.isAfter(endDate)) {
            return new ArrayList<>();
        }
        long daysBetween = ChronoUnit.DAYS.between(startDate, endDate);
        return IntStream.rangeClosed(0, (int) daysBetween)
                .boxed()
                .collect(Collectors.toList());
    }
}